﻿using AdverseEventReportSystem.BLL.Scheduling;
using AdverseEventReportSystem.BLL.SchedulingSystem;
using AdverseEventReportSystem.Core;
using AdverseEventReportSystem.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace AdverseEventReportSystem.Web.Areas.Scheduling.Controllers
{
    /// <summary>
    /// 排班备注
    /// </summary>
    public class SchedulingRemarkController : BaseController
    {
        // GET: Scheduling/SchedulingRemark
        public ActionResult Index()
        {            
            return View();
        }

        /// <summary>
        /// 保存排班备注
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ActionResult Save()
        {
            SchedulingRemark schedulingRemark = new SchedulingRemark();
            schedulingRemark.Remarks = WebUtils.GetString("Remarks");
            schedulingRemark.DepartmentCode = loginUser.CurrDepCode;
            schedulingRemark.Id = WebUtils.GetInt("Id");
            OperateResult resultInfo = ScheduleRemarkManager.SaveSchedulingRemark(schedulingRemark);
            return JsonDate(resultInfo);
        }
        /// <summary>
        /// 获取排班备注
        /// </summary>
        /// <returns></returns>
        public ActionResult GetSchedulingRemark()
        {
            string departmentCode = WebUtils.GetString("departmentCode");
            if (string.IsNullOrEmpty(departmentCode))
            {
                departmentCode = loginUser.CurrDepCode;
            }
            OperateResult resultInfo = ScheduleRemarkManager.GetSchedulingRemark(departmentCode);
            return JsonDate(resultInfo);
        }
    }
}